﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Ajax_blueSw : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        HttpContext c = HttpContext.Current;
        string hezhistr = "";
        string buleballdx = "";
        string buleballjo = "";
        string buleballsanlu = ""; 
        int lotteryType = ReadRequest.RequestInt("type");
        int count = ReadRequest.RequestInt("counts");
        int totalCount = 0;
        List<Model.LotteryAnnouncement> modellist = BLL.LotteryAnnouncement.GetPageList_Where(0, count, lotteryType, out totalCount);
         for (int i = modellist.Count - 1; i >= 0; i--)
        {
            string[] redBall = modellist[i].LotteryNo.Split('+')[0].Split(',');


            int hezhi = 0;//和值 
            int max = 0;
            int min = 35;
            for (int m = 0; m < redBall.Length; m++)
            {
                int redBalls = int.Parse(redBall[m]);
                if (redBalls > max)
                {
                    max = redBalls;
                }
                if (redBalls < min)
                {
                    min = redBalls;
                }
            }
            hezhi = max+min-21;
            if (hezhi>=13)
            {
                hezhi = 13;
            }
            if (hezhi <0)
            {
                hezhi = 0;
            }
            hezhistr += hezhi + ",";
            if (hezhi % 2 == 0)
            {
                buleballjo += "1" + ","; //双
            }
            else
            {
                buleballjo += "0" + ","; //单
            }
            if ( hezhi <= 27)
            {
                buleballdx += "0" + ","; //大 
            }
            else if (hezhi >= 28 )
            {
                buleballdx += "1" + ","; //小 
            }
            if (hezhi % 3 == 0)
            {
                buleballsanlu += "0" + ","; //三路0
            }
            else if (hezhi % 3 == 1)
            {
                buleballsanlu += "1" + ","; //三路1
            }
            else if (hezhi % 3 == 2)
            {
                buleballsanlu += "2" + ","; //三路2
            }
             
        }
        hezhistr = hezhistr.TrimEnd(',');
        buleballjo = buleballjo.TrimEnd(','); 
        buleballdx = buleballdx.TrimEnd(',');
        buleballsanlu = buleballsanlu.TrimEnd(',');
        Response.Write(hezhistr + "*" + buleballjo + "*" + buleballdx + "*" + buleballsanlu);
        Response.End();
    }
}